/**
 * 应用配置文件
 */
const path = require("path");
require("dotenv").config({ path: path.join(__dirname, '../.env') });

module.exports = {
  // 环境配置
  env: process.env.NODE_ENV || "development",
  port: parseInt(process.env.PORT, 10) || 3000,

  // API配置
  api: {
    prefix: "/api",
    version: "v1",
    timeout: 30000, // 30秒
  },

  // 跨域配置
  cors: {
    allowedOrigins: (process.env.ALLOWED_ORIGINS || "").split(","),
    credentials: true,
  },

  // 日志配置
  logs: {
    level: process.env.LOG_LEVEL || "info",
    format: process.env.NODE_ENV === "production" ? "combined" : "dev",
  },

  // 安全配置
  security: {
    apiKeySecret: process.env.API_KEY_SECRET,
    jwtSecret: process.env.JWT_SECRET || "your-jwt-secret",
    jwtExpirationInterval: process.env.JWT_EXPIRATION_MINUTES || 60 * 24 * 7, // 7天
  },

  // 语音识别配置
  speechRecognition: {
    provider: "default", // 可选：default, google, azure等
    apiKey: process.env.SPEECH_API_KEY,
    region: process.env.SPEECH_API_REGION,
  },

  // AI评分配置
  aiScoring: {
    provider: "openai", // 可选：openai, azure等
    apiKey: process.env.AI_API_KEY,
    model: process.env.AI_MODEL || "gpt-3.5-turbo",
  },

  coze: {
    oauth2TokenUrl: process.env.COZE_OAUTH2_TOKEN_URL,
    baseURL: process.env.COZE_API_BASE_URL,
    cozeApiToken: process.env.COZE_API_TOKEN,
    cozeCnBaseURL: process.env.COZE_CN_BASE_URL,
  },
};